More consistent error handling in libxl
authorStefano Stabellini <sstabellini@xensource.com>
Mon, 19 Jul 2010 17:40:09 +0000 (18:40 +0100)
committerStefano Stabellini <sstabellini@xensource.com>
Mon, 19 Jul 2010 17:40:09 +0000 (18:40 +0100)
commit965936bc9041f73b0af184d8327ef5f5c0f27d62
tree0a243cc0bfb8a0f9ea453df21631c0b836e79917
parenta9c189d680f8f13d486ca200677ef33733e39afa
More consistent error handling in libxl

Lots of places in libxl return -1 as an error which is inconsistent with
libxl error codes since that is ERROR_VERSION. Also in other places the
xc_* function to implement a command is called but the return value is
either never checked or not passed on.

This patch introduces a new internal function libxl_xc_error() which
maps xc error codes to xl error codes. Callers of libxc functions are
converted to use this when returning error codes back to libxl callers.

Also a bug is fixed where a caller depends on errno being set but is
cleared by cleanup code which calls in to library functions which modify
errno as a side-effect.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_internal.h